﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8" />
    <title>驰骋流程&表单设计器 </title>
    <base target="_self" />
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
    <link href="../Style/skin/css/login.css" rel="stylesheet" type="text/css" />
    <link href="../Scripts/bootstrap/css/bootstrap.css" rel="stylesheet" type="text/css" />
    <script src="../Scripts/QueryString.js" type="text/javascript"></script>
    <script src="../Scripts/easyUI/jquery-1.8.0.min.js" type="text/javascript"></script>
    <script src="../Scripts/config.js" type="text/javascript"></script>
    <script src="../Comm/Gener.js" type="text/javascript"></script>
    <script src="../Comm/JS/validation.js"></script>
    <script type="text/javascript">

        //初始化页面函数.....
        $(function () {

            if (! +[1,]) {
                //  alert("这是ie浏览器，您只能使用sliverlight版本浏览器。");
                // SetHref( '../XAP/Designer.htm';
                // return;
            }

            //$("#Msg").html("<img src='../Img/loading.gif' /><font color=blue>ccbpm 正在为登录/自动升级做准备.</font>");

            //document.getElementById("Btn_Login").disabled = 'disabled';
            //执行更新检查..
            var doType = GetQueryString("DoType");
            var href = GetHrefUrl();
            var urlParam = href.substring(href.indexOf('?') + 1, href.length);
            urlParam = urlParam.replace('&DoType=', '&DoTypeDel=xx');

            var handler = new HttpHandler("BP.WF.HttpHandler.WF_Portal");
            if (doType != null && doType != undefined && doType != "")
                handler.AddPara("LoginType", doType);
            handler.AddUrlData(urlParam);
            data = handler.DoMethodReturnString("Login_Init");

            if (data.indexOf('err@') == 0) {
                alert(data);
                return;
            }
            if (data.indexOf("Install") != -1) {
                var data = data.replace('url@', '');
                SetHref(data);
                return;
            }
            data = JSON.parse(data);

            //调用公共类库的方法:执行批量主表赋值
            GenerFullAllCtrlsVal(data);

            document.title = data.SysName;

            var userNo = $("#TB_No").val();
            if (userNo == "")
                $("#TB_PW").val("");

            $("body").keydown(function () {
                if (event.keyCode == 13) {
                    event.cancelBubble = true;
                    event.returnValue = false;
                    Login();
                }
            });

        });

        function LoginText() {
            SetHref( "Default.htm");
        }

        //执行后台登录.
        function Login() {

            $("#Msg").html("<font> ccbpm 正在登录流程&表单引擎设计器,请稍候... </font>");

            var handler = new HttpHandler("BP.WF.HttpHandler.WF_Portal");

            var userNo = $("#TB_No").val();
            var pass = $("#TB_PW").val();

            if (userNo == "" || pass == "") {
                $("#Msg").html("<font>请输入用户名，密码.</font>");
                return;
            }
            //判断验证码是否正确
            var node = $("#validate");
            if (node.is(':visible')) {
                if (!validateCode()) {
                    return;
                }
            }

            handler.AddPara("TB_No", userNo);
            handler.AddPara("TB_PW", pass);

            var data = handler.DoMethodReturnString("Login_Submit");

            if (data.indexOf('err@') == 0) {
                $("#Msg").html("<font color=red>" + data + "</font>");
                $("#validate").show();
                createCode();
                return;
            }

            if (data.indexOf("Install") != -1) {
                var data = data.replace('url@', '');
                SetHref(data);
                return;
            }
            if (data.indexOf('url@') == 0) {
                var data = data.replace('url@', '');
                SetHref(data);
                return;
            }


            alert(data);
        }
         
    </script>
</head>

<body class="login-bg">

    <form id="cc">
    </form>

</body>
</html>
